


*Any individual x day
quietly estpost summarize annualized_int_cost int_cost_annu if coholder==1, detail
est store a
esttab a using "Tables/CoholdingCostsPlain.tex", replace ///
collabels(none) ///
rename(annualized_int_cost "?quad Annualized daily costs" int_cost_annu "?quad Average annual costs") ///
cells("mean(fmt(%15.0fc)) sd(fmt(%15.0fc)) p50(fmt(%15.0fc)) p75(fmt(%15.0fc)) p90(fmt(%15.0fc)) p95(fmt(%15.0fc)) count(fmt(%15.0fc))") ///
nolabel nomtitles nonumbers nostar noobs booktabs fragment noline ///
substitute(? \)

*Single individual x day
quietly estpost summarize annualized_int_cost int_cost_annu if alwaysin2memberhh==0 & coholder==1, detail
est store a
esttab a using "Tables/CoholdingCostsPlain_S.tex", replace ///
collabels(none) ///
rename(annualized_int_cost "?quad Annualized daily costs" int_cost_annu "?quad Average annual costs") ///
cells("mean(fmt(%15.0fc)) sd(fmt(%15.0fc)) p50(fmt(%15.0fc)) p75(fmt(%15.0fc)) p90(fmt(%15.0fc)) p95(fmt(%15.0fc)) count(fmt(%15.0fc))") ///
nolabel nomtitles nonumbers nostar noobs booktabs fragment noline ///
substitute(? \)

*Linked individual x day
quietly estpost summarize annualized_int_cost int_cost_annu if alwaysin2memberhh==1 & coholder==1, detail
est store a
esttab a using "Tables/CoholdingCostsPlain_L.tex", replace ///
collabels(none) ///
rename(annualized_int_cost "?quad Annualized daily costs" int_cost_annu "?quad Average annual costs") ///
cells("mean(fmt(%15.0fc)) sd(fmt(%15.0fc)) p50(fmt(%15.0fc)) p75(fmt(%15.0fc)) p90(fmt(%15.0fc)) p95(fmt(%15.0fc)) count(fmt(%15.0fc))") ///
nolabel nomtitles nonumbers nostar noobs booktabs fragment noline ///
substitute(? \)

*Household x day
quietly estpost summarize annualized_int_cost_HH int_cost_annu_HH if hh_edate_obs==1 & coholder_HH==1, detail
est store b
esttab b using "Tables/CoholdingCostsPlain_HH.tex", replace ///
collabels(none) ///
rename(annualized_int_cost_HH "?quad Annualized daily costs" int_cost_annu_HH "?quad Average annual costs") ///
cells("mean(fmt(%15.0fc)) sd(fmt(%15.0fc)) p50(fmt(%15.0fc)) p75(fmt(%15.0fc)) p90(fmt(%15.0fc)) p95(fmt(%15.0fc)) count(fmt(%15.0fc))") ///
nolabel nomtitles nonumbers nostar noobs booktabs fragment noline ///
substitute(? \)

*Change unit of analysis
*Any individual level
quietly estpost summarize annualized_int_cost if edate_id==1335 & coholder==1, detail
est store a
esttab a using "Tables/CoholdingCostsPlain2.tex", replace ///
collabels(none) ///
rename(annualized_int_cost "?quad Annualized daily costs" int_cost_annu "?quad Average annual costs") ///
cells("mean(fmt(%15.0fc)) sd(fmt(%15.0fc)) p50(fmt(%15.0fc)) p75(fmt(%15.0fc)) p90(fmt(%15.0fc)) p95(fmt(%15.0fc)) count(fmt(%15.0fc))") ///
nolabel nomtitles nonumbers nostar noobs booktabs fragment noline ///
substitute(? \)

*Single individual x day
quietly estpost summarize annualized_int_cost if alwaysin2memberhh==0 & edate_id==1335 & coholder==1, detail
est store a
esttab a using "Tables/CoholdingCostsPlain2_S.tex", replace ///
collabels(none) ///
rename(annualized_int_cost "?quad Annualized daily costs" int_cost_annu "?quad Average annual costs") ///
cells("mean(fmt(%15.0fc)) sd(fmt(%15.0fc)) p50(fmt(%15.0fc)) p75(fmt(%15.0fc)) p90(fmt(%15.0fc)) p95(fmt(%15.0fc)) count(fmt(%15.0fc))") ///
nolabel nomtitles nonumbers nostar noobs booktabs fragment noline ///
substitute(? \)

*Linked individual level
quietly estpost summarize annualized_int_cost if alwaysin2memberhh==1 & edate_id==1335 & coholder==1, detail
est store a
esttab a using "Tables/CoholdingCostsPlain2_L.tex", replace ///
collabels(none) ///
rename(annualized_int_cost "?quad Annualized daily costs" int_cost_annu "?quad Average annual costs") ///
cells("mean(fmt(%15.0fc)) sd(fmt(%15.0fc)) p50(fmt(%15.0fc)) p75(fmt(%15.0fc)) p90(fmt(%15.0fc)) p95(fmt(%15.0fc)) count(fmt(%15.0fc))") ///
nolabel nomtitles nonumbers nostar noobs booktabs fragment noline ///
substitute(? \)

*Household level
quietly estpost summarize annualized_int_cost_HH if hh_edate_obs==1 & edate_id==1335 & coholder_HH==1, detail
est store b
esttab b using "Tables/CoholdingCostsPlain2_HH.tex", replace ///
collabels(none) ///
rename(annualized_int_cost_HH "?quad Annualized daily costs" int_cost_annu_HH "?quad Average annual costs") ///
cells("mean(fmt(%15.0fc)) sd(fmt(%15.0fc)) p50(fmt(%15.0fc)) p75(fmt(%15.0fc)) p90(fmt(%15.0fc)) p95(fmt(%15.0fc)) count(fmt(%15.0fc))") ///
nolabel nomtitles nonumbers nostar noobs booktabs fragment noline ///
substitute(? \)

*************************************************************

/*Histogram of interest cost of coholding
  
*Histograms

winsor annualized_int_cost, gen(w_annualized_int_cost) p(0.05) highonly 

*Histogram of annualized daily interest cost of coholding. Unit of analysis: individual x day.
hist w_annualized_int_cost if  w_annualized_int_cost != 0, frac width(500)  ///
graphregion(color(white) lcolor(white)) ///
ytitle("Fraction of observations") ///
xtitle("Annualized daily interest cost of coholding", size(medium)) ///
plotregion(color(white) lcolor(white)) bgcolor(white) color(gs10) lcolor(white) ///
xlabel(, nogrid labsize(small)) ///
ylabel(, format(%9.2fc) labsize(small)) ///
addlabels addlabopts(yvarformat(%4.2f)) ///
start(0)
graph export "Figures/AnnualizedDailyInterestCost.pdf", replace
graph export "Figures/AnnualizedDailyInterestCost.png", replace

*Histogram of annualized daily interest cost of coholding. Unit of analysis: individual x day. Without labels.
hist w_annualized_int_cost if  w_annualized_int_cost != 0, frac width(500)  ///
graphregion(color(white) lcolor(white)) ///
ytitle("Fraction of observations") ///
xtitle("Annualized daily interest cost of coholding", size(medium)) ///
plotregion(color(white) lcolor(white)) bgcolor(white) color(gs10) lcolor(white) ///
xlabel(, nogrid labsize(small)) ///
ylabel(, format(%9.2fc) labsize(small)) ///
start(0)
graph export "Figures/AnnualizedDailyInterestCostWL.pdf", replace
graph export "Figures/AnnualizedDailyInterestCostWL.png", replace


*Average annual interest costs of coholding, high values winsorized at 10% level, at individual level
winsor int_cost_annu_max, gen(w_int_cost_annu_max) p(0.10) highonly 

hist  w_int_cost_annu_max if  w_int_cost_annu_max != 0 & edate_id == 1335, fraction width(250) ///
graphregion(color(white) lcolor(white)) ///
ytitle("Fraction of observations") ///
xtitle("Average annual costs of coholding", size(medium)) ///
plotregion(color(white) lcolor(white)) bgcolor(white) color(gs10) lcolor(white) ///
xlabel(, nogrid labsize(small)) ///
ylabel(, format(%9.2fc) labsize(small)) ///
addlabels addlabopts(yvarformat(%4.2f))   
graph export "Figures/AverageAnnualInterestCost.png",  width(1800) height(1300) replace
graph export "Figures/AverageAnnualInterestCost.pdf", replace

*Average annual interest costs of coholding, high values winsorized at 10% level, at individual level, without labels
hist  w_int_cost_annu_max if  w_int_cost_annu_max != 0 & edate_id == 1335, fraction width(250) ///
graphregion(color(white) lcolor(white)) ///
ytitle("Fraction of individuals") ///
xtitle("Average annual costs of coholding", size(medium)) ///
plotregion(color(white) lcolor(white)) bgcolor(white) color(gs10) lcolor(white) ///
xlabel(, nogrid labsize(small)) ///
ylabel(, format(%9.2fc) labsize(small))   
graph export "Figures/AverageAnnualInterestCostWL.png",  width(1800) height(1300) replace
graph export "Figures/AverageAnnualInterestCostWL.pdf", replace

*/
